﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BaiduFanyi
{
    public class ResourceHelp
    {
        public StringBuilder sbValue = new StringBuilder();

        public string head = "resource";

        public Dictionary<string, string> DictValues = new Dictionary<string, string>();

        public ResourceHelp()
        {
            
        }


        /// <summary>
        /// 添加值
        /// </summary>
        /// <param name="name"></param>
        /// <param name="code"></param>
        public void AddValue(string name, string code)
        {
            DictValues.Add(name,code);
        }

        public override string ToString()
        {
            sbValue.Clear();
            sbValue.AppendLine($"<{head}>");
            foreach (KeyValuePair<string, string> keyValuePair in DictValues)
            {
                sbValue.Append($"\t<{keyValuePair.Key}>");
                sbValue.Append($"{keyValuePair.Value}");
                sbValue.AppendLine($"</{keyValuePair.Key}>");
            }
            sbValue.AppendLine($"</{head}>");
            return sbValue.ToString();
        }
    }
}
